summaryrefslogtreecommitdiff
path: root/CCCB Display/ConfigController.swift
blob: 92b6e37998fd60e0151dcfbd4cfc9caac5c1f4b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
//  ConfigController.swift
//  CCCB Display
//
//  Created by Dirk Engling on 26.05.23.
//

import Foundation
import UIKit


class ConfigController: UIViewController {

    @IBOutlet weak var display_address: UITextField!

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        let defaults = UserDefaults.standard
        if let ip = defaults.string(forKey: "Display_Address") {
            display_address.text = ip
        } else {
            display_address.text = "172.23.42.29"
        }
    }

    @IBAction func cancelPressed(_ sender: Any) {
        self.dismiss(animated: true)
    }

    @IBAction func donePressed(_ sender: Any) {
        self.dismiss(animated: true)
        let defaults = UserDefaults.standard
        defaults.set(display_address.text, forKey: "Display_Address")
    }
}